//
// CSkeletonShape.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.IStream;

public class CSkeletonShape extends IShape {
  private long swigCPtr;

  public CSkeletonShape(long cPtr, boolean cMemoryOwn) {
    super(nel3dJNI.CSkeletonShape_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  public static long getCPtr(CSkeletonShape obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CSkeletonShape(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public CSkeletonShape() {
    this(nel3dJNI.new_CSkeletonShape(), true);
  }

  public void build(SWIGTYPE_p_std__vectorT_NL3D__CBoneBase_t bones) {
    nel3dJNI.CSkeletonShape_build(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CBoneBase_t.getCPtr(bones));
  }

  public void retrieve(SWIGTYPE_p_std__vectorT_NL3D__CBoneBase_t bones) {
    nel3dJNI.CSkeletonShape_retrieve(swigCPtr, this, SWIGTYPE_p_std__vectorT_NL3D__CBoneBase_t.getCPtr(bones));
  }

  public int getBoneIdByName(String name) {
    return nel3dJNI.CSkeletonShape_getBoneIdByName(swigCPtr, this, name);
  }

  public CTransformShape createInstance(CScene scene) {
    long cPtr = nel3dJNI.CSkeletonShape_createInstance(swigCPtr, this, CScene.getCPtr(scene), scene);
    return (cPtr == 0) ? null : new CTransformShape(cPtr, false);
  }

  public boolean clip(SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t pyramid, SWIGTYPE_p_NLMISC__CMatrix worldMatrix) {
    return nel3dJNI.CSkeletonShape_clip(swigCPtr, this, SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t.getCPtr(pyramid), SWIGTYPE_p_NLMISC__CMatrix.getCPtr(worldMatrix));
  }

  public void render(IDriver arg0, CTransformShape arg1, boolean arg2) {
    nel3dJNI.CSkeletonShape_render(swigCPtr, this, IDriver.getCPtr(arg0), arg0, CTransformShape.getCPtr(arg1), arg1, arg2);
  }

  public void getAABBox(SWIGTYPE_p_NLMISC__CAABBox bbox) {
    nel3dJNI.CSkeletonShape_getAABBox(swigCPtr, this, SWIGTYPE_p_NLMISC__CAABBox.getCPtr(bbox));
  }

  public float getNumTriangles(float distance) {
    return nel3dJNI.CSkeletonShape_getNumTriangles(swigCPtr, this, distance);
  }

  public void serial(IStream f) {
    nel3dJNI.CSkeletonShape_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void flushTextures(IDriver arg0, long arg1) {
    nel3dJNI.CSkeletonShape_flushTextures(swigCPtr, this, IDriver.getCPtr(arg0), arg0, arg1);
  }

  public long getLodForDistance(float dist) {
    return nel3dJNI.CSkeletonShape_getLodForDistance(swigCPtr, this, dist);
  }

  public SWIGTYPE_p_NL3D__CSkeletonShape__CLod getLod(long lod) {
    return new SWIGTYPE_p_NL3D__CSkeletonShape__CLod(nel3dJNI.CSkeletonShape_getLod(swigCPtr, this, lod), false);
  }

  public long getNumLods() {
    return nel3dJNI.CSkeletonShape_getNumLods(swigCPtr, this);
  }

}
